﻿namespace com.oakwoodsys.ConsultantCare
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class MessageHandler
    {
        #region Fields

        const string BaseUrl = "/_layouts/com.oakwoodsys.consultcarecal/CustomErrorPage.aspx?e={0}";

        #endregion Fields

        #region Methods

        public static string GetRedirectUrl( string message, params object[ ] args )
        {
            string s = string.Format( message, args );
            return string.Format( BaseUrl, s );
        }

        #endregion Methods

        #region Nested Types

        public class Message
        {
            #region Nested Types

            public class Consultant
            {
                #region Fields

                /// <summary>
                /// The consultant was not added. Reason: The calendar configured for the specified recruiter was not found. Resolution: Either Choose another recruiter or Reconfigure the recruiter in the SharePoint list 'Recruiters' with the correct calendar or Create the configured calendar and then add the consultant.
                /// </summary>
                public const string ConsultantNotAddedCalendarNotFound = "<p>The consultant was not added.</p><h3>Reason:</h3><p>The calendar configured for the specified recruiter was not found.</p><h3>Resolution:</h3><p>Either<ul><li>Choose another recruiter</li><li>Reconfigure the recruiter in the SharePoint list 'Recruiters' with the correct calendar</li><li>Create the configured calendar</li></ul>and then add the consultant.</p>";

                /// <summary>
                /// The consultant was not added. Reason: The calendar configured as the master calendar was not found. Resolution: Configure an existing calendar and then add the consultant.
                /// </summary>
                public const string ConsultantNotAddedMasterCalendarNotFound = "<p>The consultant was not added.</p><h3>Reason:</h3><p>The calendar configured as the master calendar was not found.</p><h3>Resolution:</h3><p>Configure an existing calendar and then add the consultant</p>";

                /// <summary>
                /// The consultant was not added. Reason: The specified recruiter is not configured in the SharePoint list 'Recruiters'. Resolution: Either Choose a recruiter that is already configured or Add the recruiter to the SharePoint list 'Recruiters' and then add the consultant.
                /// </summary>
                public const string ConsultantNotAddedRecruiterNotFound = "<p>The consultant was not added.</p><h3>Reason:</h3><p>The specified recruiter is not configured in the SharePoint list 'Recruiters'.</p><h3>Resolution:</h3><p>Either<ul><li>Choose a recruiter that is already configured</li><li>Add the recruiter to the SharePoint list 'Recruiters'</li></ul>and then add the consultant.</p>";

                /// <summary>
                /// The consultant was not updated. Reason: The calendar configured for the specified recruiter was not found. Resolution: Either Choose another recruiter or Reconfigure the recruiter {1} in the SharePoint list 'Recruiters' with the correct calendar or Create the configured calendar and then update the consultant {0}.
                /// </summary>
                public const string ConsultantNotUpdatedCalendarNotFound = "<p>The consultant was not updated.</p><h3>Reason:</h3><p>The calendar configured for the specified recruiter was not found.</p><h3>Resolution:</h3><p>Either<ul><li>Choose another recruiter</li><li>Reconfigure the recruiter <b>{1}</b> in the SharePoint list 'Recruiters' with the correct calendar</li><li>Create the configured calendar</li></ul>and then update the consultant <b>{0}</b>.</p>";

                /// <summary>
                /// The consultant was not updated. Reason: The configured master calendar was not found. Resolution: Configure the master calendar and then update the consultant {0}.
                /// </summary>
                public const string ConsultantNotUpdatedMasterCalendarNotFound = "<p>The consultant was not updated.</p><h3>Reason:</h3><p>The configured master calendar was not found.</p><h3>Resolution:</h3><p>Configured the master calendar and then update the consultant <b>{0}</b>.</p>";

                /// <summary>
                /// The consultant was not updated. Reason: The specified recruiter is not configured in the SharePoint list 'Recruiters'. Resolution: Either Choose a recruiter that is already configured or Add the recruiter {1} to the SharePoint list 'Recruiters' and then update the consultant {0}.
                /// </summary>
                public const string ConsultantNotUpdatedRecruiterNotFound = "<p>The consultant was not updated.</p><h3>Reason:</h3><p>The specified recruiter is not configured in the SharePoint list 'Recruiters'.</p><h3>Resolution:</h3><p>Either<ul><li>Choose a recruiter that is already configured</li><li>Add the recruiter <b>{1}</b> to the SharePoint list 'Recruiters'</li></ul>and then update the consultant <b>{0}</b>.</p>";

                #endregion Fields
            }

            public class Recruiter
            {
                #region Fields

                /// <summary>
                /// The recruiter was not deleted. Reason: The recruiter is currently associated with one or more consultants. Resolution: Associate the consultants with another recruiter and then delete the recruiter {0}. The consultants can be found in the SharePoint list 'Consultants'.
                /// </summary>
                public const string RecruiterNotDeletedRecruiterIsReferenced = "<p>The recruiter was not deleted.</p><h3>Reason:</h3><p>The recruiter is currently associated with one or more consultants.</p><h3>Resolution:</h3><p>Associate the consultants with another recruiter and then delete the recruiter <b>{0}</b>. The consultants can be found in the SharePoint list 'Consultants'.</p>";

                #endregion Fields
            }

            #endregion Nested Types
        }

        #endregion Nested Types
    }
}